package com.qinhailin.portal.qrcode.controller;

import com.jfinal.aop.Inject;
import com.jfinal.plugin.activerecord.Record;

import com.qinhailin.common.base.BaseController;
import com.qinhailin.common.routes.ControllerBind;
import com.qinhailin.common.model.WeixinUser;
import com.qinhailin.portal.qrcode.service.WeixinUserService;

/**
 * null
 * @author yangguoda
 * @date 2019-12-08
 */
@ControllerBind(path="/portal/qrcode/weixinUser")
public class WeixinUserController extends BaseController {

   @Inject
   WeixinUserService service;

  	public void index(){
    	render("index.html");
  	}
    
   public void list() {
      Record record=new Record();
      record.set("searchName",getPara("searchName"));
      renderJson(service.page(getParaToInt("pageNumber", 1), getParaToInt("pageSize", 10),record));
	}
    
   public void add() {
    	render("add.html");
   }

   public void save() {
    	WeixinUser entity=getBean(WeixinUser.class);
    	entity.setId(createUUID());
    	entity.save();
    	setAttr("weixinUser", entity);
    	render("add.html");
   }

   public void edit() {
      setAttr("weixinUser", service.findById(getPara(0)));
      render("edit.html");
   }

   public void update() {
      WeixinUser entity=getBean(WeixinUser.class);
      entity.update();
      setAttr("weixinUser", entity);
      render("edit.html");
   }

   public void delete() {
      service.deleteByIds(getIds());
      renderJson(suc());
   }

}